/*
 * Copyright 2018 Xiaomi, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package common

import (
	"encoding/base64"
	"fmt"
	"io/ioutil"
	"net/http"
	"os"
	"strings"

	"github.com/russross/blackfriday"
)

// BuiltinCSS 内置HTML风格
var BuiltinCSS = `
a:link,a:visited{text-decoration:none}h3,h4{margin-top:2em}h5,h6{margin-top:20px}h3,h4,h5,h6{margin-bottom:.5em;color:#000}body,h1,h2,h3,h4,h5,h6{color:#000}ol,ul{margin:0 0 0 30px;padding:0 0 12px 6px}ol,ol ol{list-style-position:outside}table td p,table th p{margin-bottom:0}input,select{vertical-align:middle;padding:0}h5,h6,input,select{padding:0}hr,table,textarea{width:100%}body{margin:20px auto;width:800px;background-color:#fff;font:13px "Myriad Pro","Lucida Grande",Lucida,Verdana,sans-serif}h1,table th p{font-weight:700}a:link{color:#00f}a:visited{color:#00a}a:active,a:hover{color:#f60;text-decoration:underline}* html code,* html pre{font-size:101%}code,pre{font-size:11px;font-family:monaco,courier,consolas,monospace}pre{border:1px solid #c7cfd5;background:#f1f5f9;margin:20px 0;padding:8px;text-align:left}hr{color:#919699;size:1;noshade:"noshade"}h1,h2,h3,h4,h5,h6{font-family:"Myriad Pro","Lucida Grande",Lucida,Verdana,sans-serif;font-weight:700}h1{margin-top:1em;margin-bottom:25px;font-size:30px}h2{margin-top:2.5em;font-size:24px;padding-bottom:2px;border-bottom:1px solid #919699}h3{font-size:17px}h4{font-size:15px}h5{font-size:13px}h6{font-size:11px}table td,table th{font-size:12px;border-bottom:1px solid #919699;border-right:1px solid #919699}p{margin-top:0;margin-bottom:10px}ul{list-style:square}li{margin-top:7px}ol{list-style-type:decimal}ol ol{list-style-type:lower-alpha;margin:7px 0 0 30px;padding:0 0 0 10px}ul ul{margin-left:40px;padding:0 0 0 6px}li>p{display:inline}li>a+p,li>p+p{display:block}table{border-top:1px solid #919699;border-left:1px solid #919699;border-spacing:0}table th{padding:4px 8px;background:#E2E2E2}table td{padding:8px;vertical-align:top}table td p+p,table td p+p+p{margin-top:5px}form{margin:0}button{margin:3px 0 10px}input{margin:0 0 5px}select{margin:0 0 3px}textarea{margin:0 0 10px}
`

// BuiltinJavascript 内置 SQL 美化 Javascript 脚本
var BuiltinJavascript = `IWZ1bmN0aW9uKGUsRSl7Im9iamVjdCI9PXR5cGVvZiBleHBvcnRzJiYib2JqZWN0Ij09dHlwZW9mIG1vZHVsZT9tb2R1bGUuZXhwb3J0cz1FKCk6ImZ1bmN0aW9uIj09dHlwZW9mIGRlZmluZSYmZGVmaW5lLmFtZD9kZWZpbmUoW10sRSk6Im9iamVjdCI9PXR5cGVvZiBleHBvcnRzP2V4cG9ydHMuc3FsRm9ybWF0dGVyPUUoKTplLnNxbEZvcm1hdHRlcj1FKCl9KHRoaXMsZnVuY3Rpb24oKXtyZXR1cm4gZnVuY3Rpb24oZSl7ZnVuY3Rpb24gRShuKXtpZih0W25dKXJldHVybiB0W25dLmV4cG9ydHM7dmFyIHI9dFtuXT17ZXhwb3J0czp7fSxpZDpuLGxvYWRlZDohMX07cmV0dXJuIGVbbl0uY2FsbChyLmV4cG9ydHMscixyLmV4cG9ydHMsRSksci5sb2FkZWQ9ITAsci5leHBvcnRzfXZhciB0PXt9O3JldHVybiBFLm09ZSxFLmM9dCxFLnA9IiIsRSgwKX0oW2Z1bmN0aW9uKGUsRSx0KXsidXNlIHN0cmljdCI7ZnVuY3Rpb24gbihlKXtyZXR1cm4gZSYmZS5fX2VzTW9kdWxlP2U6eyJkZWZhdWx0IjplfX1FLl9fZXNNb2R1bGU9ITA7dmFyIHI9dCgxOCksVD1uKHIpLFI9dCgxOSksbz1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9IGRvY3VtZW50LmdldEVsZW1lbnRzQnlDbGFzc05hbWUoJ2xhbmd1YWdlLXNxbCcpOwoJCiAgICAJICAgIGZvciAobGV0IGkgPSAwIDtpPGNvZGVMaXN0Lmxlbmd0aDtpKyspIHsKICAgIAkgICAgICAgIGNvZGVMaXN0W2ldLmlubmVySFRNTCA9IHdpbmRvdy5zcWxGb3JtYXR0ZXIuZm9ybWF0KGVzY2FwZTJIdG1sKGNvZGVMaXN0W2ldLmlubmVySFRNTCkpCiAgICAJICAgIH0KICAgIAl9Owo=
`

// MarkdownEscape markdown格式转义，原样输出
func MarkdownEscape(str string) string {
	for _, b := range "_`*" {
		str = strings.Replace(str, string(b), "\\"+string(b), -1)
	}
	return str
}

// loadExternalResource load js/css resource from http[s] url
func loadExternalResource(resource string) string {
	var content string
	var body []byte
	if strings.HasPrefix(resource, "http") {
		resp, err := http.Get(resource)
		if err != nil {
			Log.Error("http.Get %s Error: %v", resource, err)
			return content
		}
		defer resp.Body.Close()

		body, err = ioutil.ReadAll(resp.Body)
		if err != nil {
			Log.Error("ioutil.ReadAll %s Error: %v", resource, err)
		} else {
			content = string(body)
		}
	} else {
		fd, err := os.Open(resource)
		if err != nil {
			Log.Error("os.Open %s Error: %v", resource, err)
			return content
		}
		defer fd.Close()

		body, err = ioutil.ReadAll(fd)
		if err != nil {
			Log.Error("ioutil.ReadAll %s Error: %v", resource, err)
		} else {
			content = string(body)
		}
	}
	return content
}

// MarkdownHTMLHeader markdown 转 HTML 输出时添加 HTML 头
func MarkdownHTMLHeader() string {
	// load css
	var css string
	if Config.ReportCSS == "" {
		css = BuiltinCSS
	} else {
		css = loadExternalResource(Config.ReportCSS)
	}

	// load javascript
	var js string
	if Config.ReportJavascript == "" {
		decode, _ := base64.StdEncoding.DecodeString(BuiltinJavascript)
		js = string(decode)
	} else {
		js = loadExternalResource(Config.ReportJavascript)
	}

	header := `<head>
<meta http-equiv=Content-Type content="text/html;charset=utf-8">
<title>` + Config.ReportTitle + `</title>
<script>` + js + `</script>
<style id="soar_md">
` + css + `
</style>
</head>
<body onload=load()>
`
	return header
}

// Markdown2HTML markdown 转 HTML 输出
func Markdown2HTML(buf string) string {
	// extensions default: 94
	// extensions |= blackfriday.EXTENSION_TABLES
	// extensions |= blackfriday.EXTENSION_FENCED_CODE
	// extensions |= blackfriday.EXTENSION_AUTOLINK
	// extensions |= blackfriday.EXTENSION_STRIKETHROUGH
	// extensions |= blackfriday.EXTENSION_SPACE_HEADERS
	extensions := Config.MarkdownExtensions

	// htmlFlags
	htmlFlags := Config.MarkdownHTMLFlags

	renderer := blackfriday.HtmlRenderer(htmlFlags, "", "")
	buf = string(blackfriday.Markdown([]byte(buf), renderer, extensions))
	return buf
}

// Score SQL评审打分
func Score(score int) string {
	// 不需要打分的功能
	switch Config.ReportType {
	case "duplicate-key-checker", "explain-digest":
		return ""
	}
	s1, s2 := "★ ", "☆ "
	if score > 100 {
		score = 100
		Log.Debug("Score Error: score larger than 100, %d", score)
	}
	if score < 0 {
		score = 0
		Log.Debug("Score Warn: score less than 0, %d", score)
	}
	s1Count := score / 20
	s2Count := 5 - s1Count
	str := fmt.Sprintf("%s %d分", strings.TrimSpace(strings.Repeat(s1, s1Count)+strings.Repeat(s2, s2Count)), score)
	return str
}
